<html><head>
<script type="text/javascript">

// Cognos Connection content pages seem to contain an "alternate" link
// to their content as an RSS feed.
// "extractRssUrl" is a hack to extract that link without first converting
// the HTML text into document object model form.

function extractRssUrl(text)
{
  rss_link_index = text.indexOf('<link rel="alternate" type="application/rss+xml"');
  if (rss_link_index == -1)
  {
    return "";
  }
  else
  {
    rss_link = text.slice(rss_link_index, text.indexOf(">", rss_link_index) + 1);
    href_begin = rss_link.indexOf('href=') + 6;  // after href="
    href_end = rss_link.indexOf('"', href_begin);
    rss_url = rss_link.slice(href_begin, href_end);
    return rss_url;
  }
}

// --------------------------------------------------

</script>
</head><body>
<script type="text/javascript">

// "http" is our HTTP communicator.
http = new XMLHttpRequest();

url_public_content = "https://dwhsep.doemass.org/cognos8/cgi-bin/cognosisapi.dll?b_action=xts.run&m=portal/cc.xts&m_path=%2fcontent";
url_ESE_MCAS =       "https://dwhsep.doemass.org/cognos8/cgi-bin/cognosisapi.dll?b_action=xts.run&m=portal/cc.xts&m_folder=i417F166EB4AE47F4B572EA14C623D814";

// First retrieve the Cognos Connection public folders page as HTML.
http.open("GET", url_public_content, false);
http.send(null);
text = http.responseText;

// Try to extract the URL for an RSS version of the content.
rssUrl = extractRssUrl(text);
if (! rssUrl)
{
  alert("I couldn't find an alternate link in the content page.");
}
else
{
  // Fetch the RSS feed.
  http.open("GET", rssUrl, false);
  http.send(null);
  rssXml = http.responseXML;
}

document.write("<br/><pre>");
document.write(text.replace(/</g, "<br/>&lt;"));
//document.write(text.replace(/</g, "&lt;"));
document.write("</pre>");

</script>
</body></html>
